package domain

import (
	"github.com/lab-online/internal/course/constant"
	"github.com/lab-online/internal/course/entity"
	"github.com/lab-online/internal/shared/code"
)

func (d *Domain) GetCourseDetail(course entity.CourseEntity) (entity.CourseEntity, error) {
	savedCourse, err := d.repository.GetCourseWithExperiments(course.GetID())
	if err != nil {
		return nil, code.
			ErrorPicker(err, code.DatabaseCourseNotFound, constant.RESTErrCourseNotFound)
	}
	return savedCourse, nil
}
